﻿using System.ComponentModel.DataAnnotations;
using Abp.Auditing;
using Abp.Authorization.Users;

namespace ARchGL.Platform.Web.Models.TokenAuth
{
    public class AuthenticateModel
    {
        private string userNameOrEmailAddress;

        /// <summary>
        /// 用户名或邮箱地址
        /// </summary>
        [Required]
        [MaxLength(AbpUserBase.MaxEmailAddressLength)]
        public string UserNameOrEmailAddress
        {
            get => userNameOrEmailAddress;
            set => userNameOrEmailAddress = value?.Replace("\t", "")?.Trim();//有可能出现用户名包含 \t 的风险，但是实际操作中 \t 频率出现太高，所以选择剔除。;
        }

        /// <summary>
        /// 登录密码
        /// </summary>
        [Required]
        [MaxLength(AbpUserBase.MaxPlainPasswordLength)]
        [DisableAuditing]
        public string Password { get; set; }

        public string TwoFactorVerificationCode { get; set; }

        public bool RememberClient { get; set; }

        public string TwoFactorRememberClientToken { get; set; }

        public bool? SingleSignIn { get; set; }

        /// <summary>
        /// 登录类型：1Web、2Android、3iOS、4H5、5Wechat、6小程序
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 登录后跳转到这里
        /// </summary>
        public string ReturnUrl { get; set; }
    }
}